/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

Ext.QuickTips.init();
var _pageSize = 20;


var fieldName = ["orgCode","orgName","shortName","total","onlineCount","offlineCount","reportCount","observeCount","startCount","stopCount"];
var fieldLabel = ["机构编码","单位名称","单位简称","装置总数","在线数量","离线数量","上报数量","观测数量","启用数量","停用数量"];          

var loadServlet = basePath + 'servlet/system/PointLoad';

var theme = '监测点工况';

var _title = currentOrgName + theme + '管理';

var now = new Date();

var checkboxSel = new Ext.grid.CheckboxSelectionModel();
var store;
function buildWindow() {
    store = new Ext.data.JsonStore({
        url: loadServlet,
        root: 'data',
        idProperty: 'orgCode',
        totalProperty: 'count',
        fields: fieldName,
        baseParams: {start: 0, limit: _pageSize,cmd:"workStatus"}
        , autoLoad: true
    });

    var grid = new Ext.grid.GridPanel({
        title: _title,
        store: store,
        sm: checkboxSel,
        autoExpandColumn: 'OrgName',
        columns: [
            checkboxSel,
            {header: fieldLabel[0], width: 80, dataIndex: fieldName[0],  hidden: true},
            {header: fieldLabel[1], width: 150, dataIndex: fieldName[1],id:'OrgName'},
            {header: fieldLabel[2], width: 80, dataIndex: fieldName[2],hidden:true},
            {header: fieldLabel[3], width: 80, dataIndex: fieldName[3],xtype:'numbercolumn',align:'right',format:'0'},
            {header: fieldLabel[4], width: 80, dataIndex: fieldName[4],xtype:'numbercolumn',align:'right',format:'0'},
            {header: fieldLabel[5], width: 80, dataIndex: fieldName[5],xtype:'numbercolumn',align:'right',format:'0'},
            {header: fieldLabel[6], width: 80, dataIndex: fieldName[6],xtype:'numbercolumn',align:'right',format:'0'},
            {header: fieldLabel[7], width: 80, dataIndex: fieldName[7],xtype:'numbercolumn',align:'right',format:'0'},
            {header: fieldLabel[8], width: 80, dataIndex: fieldName[8],xtype:'numbercolumn',align:'right',format:'0'},
            {header: fieldLabel[9], width: 80, dataIndex: fieldName[9],xtype:'numbercolumn',align:'right',format:'0'}
        ],
        loadMask: true,       
        bbar: new Ext.PagingToolbar({
            pageSize: _pageSize,
            store: store,
            displayInfo: true,
            displayMsg: '显示记录：{0} - {1}   总记录：{2}',
            emptyMsg: "目前没有" + theme + '信息'
        })
    });
    var applicationUI = new Ext.Viewport({
        layout: "fit",
        items: [
            grid
        ]
    });
}
Ext.onReady(buildWindow);
